function [FOC] = eqfind_bondonly(controls,pi1,w1,w2,y1vec,y2vec,yf,gamma,gammaf,relativesize,bondpayoff)
%This function computes the cournot-walras equilibrium when markets are
%incomplete with the only asset for sale being the bond

a1=controls(1);%asset positions of Type 1
a2=-a1;%Back out from market clearing with a small fringe
af=controls(2);

pivec=[pi1,1-pi1];

cf=yf+bondpayoff*af;

bondprice=sum(pivec.*bondpayoff.*(cf).^(-gammaf)); %Prices

priceimpactbond=sum(gammaf*pivec.*(bondpayoff.^2).*(cf).^(-gammaf-1));


c01=w1-bondprice*a1; %Type 1 consumption within the period
c02=w2-bondprice*a2; %Type 2 consumption within the period

c1prime=y1vec+bondpayoff*a1; %Type 1: 1x2 vector of state-contingent updated wealth
c2prime=y2vec+bondpayoff*a2; %Type 2: 1x2 vector of state-contingent updated wealth

%Compute state prices
Lambda1=(pivec.* c1prime.^(-gamma))./(c01^(-gamma));
Lambda2=(pivec.* c2prime.^(-gamma))./(c02^(-gamma));

FOC=[sum(bondpayoff.*Lambda1)-bondprice-(relativesize)*priceimpactbond.*a1,sum(bondpayoff.*Lambda2)-bondprice-(relativesize)*priceimpactbond.*a2];

end